/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nu.zoom.catonine.desktop;

import javax.swing.JComponent;

import nu.zoom.swing.desktop.worker.EventQueuePolicy;
import nu.zoom.swing.desktop.worker.Policy;

/**
 * Utility to switch cursor to another state if a background task takes a long time.
 * @author "Johan Maasing" &lt;johan@zoom.nu&gt;
 */
public interface DelayedCursorSwitcher {

    /**
     * Request that the cursor should be switched to Cursor.WAIT_CURSOR after a 
     * while. If the schedule has not been cancelled before the timeout the 
     * cursor will be changed. This is to keep background tasks from switching
     * the cursor if they finish quickly but if they take some time the cursor 
     * will switch.
     */
    public void scheduleWaitCursor(JComponent component);

    /**
     * If we have scheduled a cursor switch then cancel it. Also sets the cursor
     * to the default cursor if it has been switched to Cursor.WAIT_CURSOR.
     */
    @EventQueuePolicy(Policy.EVENT_QUEUE)
    public void cancelScheduleAndSetDefaultCursor(JComponent component);
}
